1. Field of the Invention
The present invention relates to a file server maintaining snapshot copies of a read-write file by sharing file blocks and performing a copy-on-write to a newly allocated block when writing to a shared block.
2. Description of the Related Art
A technique known as file versioning maintains read-only versions of a read-write production file by sharing file blocks between the production file and the read-only versions, and performing a copy-on-write to a newly allocated block for the production file when writing to a shared block. Such a file system is described in Chutani, Sailesh, et al., “The Episode File System,” Carnegie Mellon University IT Center, Pittsburgh, Pa., June 1991, incorporated herein by reference. Each read-only version is a snapshot of the production file at a respective point in time. Read-only versions can be used for on-line data backup and data mining tasks.
In a copy-on-write file versioning method, the read-only version initially includes only a copy of the inode of the production file. Therefore the read-only version initially shares all of the data blocks as well as any indirect blocks of the production file. When the production file is modified, new blocks are allocated and linked to the production file inode to save the new data, and the original data blocks are retained and linked to the inode of the read-only version. The result is that disk space is saved by only saving the difference between two consecutive versions. If the production file becomes corrupted during a system crash, then typically the most recent read-only version is copied over to the production file in a recovery operation. In this case, there is a loss of the data that was written to the production file since the creation of the most recent read-only version.
Users are becoming less tolerant of delays in accessing their data, and even less tolerant of corruption of their data. Therefore, there has been a continuing interest in improving data availability and the effectiveness of recovery procedures. For example, after recovery, the integrity of the recovered file is checked, and if a defect is found, an attempt is made to correct it. In addition, it is often possible to recover some of the data that was written to the production file since the creation of the latest read-only version, for example, by replay of a log from an application program.